/**
 * @file Encoder.hpp
 * @brief 基于Raspberry 4B+ v4l2方案的H264硬件加速编码
 */

#include "../../BaseEncoder.hpp"
#include <gst/gst.h>

class Encoder : public BaseEncoder
{
  private:
    GstElement *pipeline;
    GstElement *appsrc,*videoconvert,*capsfliter,*v4l2h264enc,*mpegtsmux,*srtsink;
    GstBus *bus;
    bool status=false;
    long imageSize;

  public:

    Encoder(const std::string& srturi);

    virtual ~Encoder();

    virtual void StartStream(int width,int height,const ImageType& type) override;

    virtual void InputImage(const unsigned char* img) override;

    virtual void EndStream() override;

    /**
     * @brief 获取状态
     */
    virtual bool GetStatus() override;
};
